package com.zpy.playground.mybatisTest;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zpy.playground.mybatisTest.entity.UkTest;
import com.zpy.playground.mybatisTest.mapper.UkTestMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/db")
public class DbController {
    @Autowired
    private UkTestMapper ukTestMapper;

    @PostMapping("/get")
    public void get() {
        LambdaQueryWrapper<UkTest> queryWrapper = new QueryWrapper<UkTest>()
            .lambda()
            .eq(UkTest::getId, 1);
        List<UkTest> ukTest1 = ukTestMapper.selectList(queryWrapper);
        UkTest ukTest2 = ukTestMapper.selectById(1L);
        System.out.println();
    }
}
